<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>文字居中和盒子居中</title>
    <style>
        div{
            width: 200px;
            height: 200px;
            background-color: limegreen;
            margin: 0 auto;
            text-align: center;
        }
    </style>
</head>
<body>
    <div>xxx</div>
</body>
</html>